/*
* ============================================================================
*  Name        : example_006.h
*  Part of     : Finite state machine examples
*  Description : Class definition
*  Version     : %version: %
*  
*
* ============================================================================
*/
#if !defined(  __sm_example_006_h__ )
#define __sm_example_006_h__

#include <sea_statemachine>

// sea:: State Event Action namespace
using namespace sea;

/**
 * @file example_006.h
 * @brief Example how to dispatch state machine in existing event handling systems
 * like Qt
 *
 * @ingroup StateMachineExamples
 *
 */
namespace sea_examples
{
    /**
     * @class Embedded
     * @brief \b Examples: The class is dispatched outside of the framework
     *
     * @ingroup StateMachineExamples
     */
    class Embedded : public StateMachine
    {
    public:
        Embedded( int aLimit ) : 
          StateMachine( STATEMACHINE_NAME ), 
            m_wrong_moves_counter( 0 ),
            m_limit( aLimit ) { }

        // public event
        EVENT_EXT( Embedded, Ev_Ext_UserKey );

    private:
        // Private events
        EVENT_INT( Embedded, Ev_Int_MoveRight );
        EVENT_INT( Embedded, Ev_Int_MoveLeft );
        EVENT_INT( Embedded, Ev_Int_WrongKey );

        ACT( Embedded, process_key_press );
        ACT( Embedded, on_right_move );
        ACT( Embedded, on_left_move );
        ACT( Embedded, wrong_move );
        ACT( Embedded, unknown_key );
        ACT( Embedded, good_bye );
    private:
        int m_wrong_moves_counter;
        int m_limit;
    };

    void launch_example_006( );
    void launch_example_0061( );
}

#endif
